<?php
class EditGroup extends Action {
	/*
	 * (non-PHPdoc) @see Action::execute()
	 */
	public function execute($params) {
		check_login ( ADMIN_LOGIN_PAGE );
		$gid = irqst ( 'gid' );
		if (empty ( $gid )) {
			$data ['page_tip_info'] = "<strong>出错啦!</strong>uid为空，系统无法加载对应用户组。";
		} else {
			$group = sess_del ( 'group_info', false );
			if (! $group) {
				$groupModel = new CoreGroupModel ();
				$group = $groupModel->read ( $gid );
			}
			if ($group == false) {
				$data ['page_tip_info'] = "<strong>出错啦!</strong>uid为{$gid}的用户组不存在。";
			} else {
				$data = $group;
				$data ['group'] = $group;
				$data ['page_tip_info'] = sess_del ( 'page_tip_info' );
			}
		}
		$data ['group_types'] = apply_filter('get_group_types', array(''=>'-请选择组类别-'));
		$data ['alert_cls'] = 1 == irqst ( 'suc', 0 ) ? 'alert-success' : 'alert-error';
		$data ['error'] = sess_del ( 'group_error', array () );
		$data ['error_cls'] = ModelValidator::getErrorCls ( $data ['error'] );
		return new SmartyView ( $data, 'group/EditGroup' );
	}
}